package com.seventh.parkingrent.alipay.config;

import org.springframework.context.annotation.Configuration;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */
@Configuration
public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000117685730";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCXW5fs9YPDkNrMOa6yS+F4HwgC06VxYkt+bhvIXynRw+vA5qXuIEw1wjKXJM0r9CwdEE3AtCbGIEw9PD8lv4STSeA5WjWcXlIKWnSUjs2Rcx/M8LTbeKkAW6RZBBJnM0hllrtQgfl43heEVlulFnX2iwJy1kJgfJ9VAA1KHmlyJc3OjSl5uDI/AL40bG+yj+o6UgImq38kjrkeMdAHhpECYAJDHa+oflykR8UQmZj9I0O0lh4vNWFbfs7yYmb/fZD21oafaVCnOHCNj/pjdZ8ZzHJprLyxQuN7ff/YfGbSd4DJtV2wV4hnrEXxdaLG+ywPbz5vf+yZdMhV3oIIyBpPAgMBAAECggEAaFRUVputJYKVrqwcBP5U/i21oe0tXwh4LT/MmsMt2k+IE8FooslUfsHLiW9ulVuLhMUWMzx6dZsRsivzAxwOUFBd5GqQBabmOgi7zyLYA+gtBWDt6VI0e/CvSkSKQuSQhKXvm8Dbqzq7TxcPuK3Qxg5vs6SIwGVmlnqgrnRkDq93Ob7wpAlBE/oK3vubcjOCCsPCcaz18FS/fF0lrWqpIHX3x0Y6s1Mi4ce2ffEUyJozzFZXg0FQ9mw/jbeJaM/6BWFClHuuVbOL6YT61kYcWV73R9jlegNUErM7cOD98b6T64OMkr+P9R4cZBPa8It/TvRcjyKCC+49HdWZobukcQKBgQDxQ0AtUED/Ook74lvawa1B4C4Crm0B8rrNXewCBp75nnhqaNXd8Rp0Ew/h/PYnyt+AuIdEJujKzMMQpZV7WkzhZHOCJQY4zH5WHWwhdCsic9ZVqy8gM9DAwE6n0vYtAlb6JHSIPjhcJFlcvgarvoQilwi1my798EM72ANLW/SfNQKBgQCgmnQKJH2YvnkrnCnXvo6mI/RAob23AHbtRlxwOSRN5QDmiYmUNaPdYwSK7FWv6K3YXmP+Qg1jhbF/Yqs34B5u9eoP0EBrAPfo1aoeZLd4fd2gk3dKcDnT/nqCgw6F9i76iOBEm4YgZHmtBDzLjcLZw117PihrA7pAxOHTBPlv8wKBgGWavNxYgAb8z+64VZa7Ggw0LSxT6PR5FNKIS2xO/YSCiJPHssnVUB6yKG4z6ja36Yh8Lfs1p7RAp6XLFjjsvpPtife1P/mLpWj+2xr7oW7Q+eL6RM57A98pHfbvkV1DLv4JfEokaffkFv5HyOdrRJqMoM5anF+1X5tETZ7fCxZBAoGAB5KAuiGyUktYxzebuXJgo3C6iXmWylQZR2Kz5Q6sqYeMnVIKzJQi38NVaX9vItYjrDn3GPvgSbr5/XmXfRDyHmU13f0BrInlJnM8jCZPiDzXAEUzsKzN7TLob9LiEmrjGCjv+gwjLM/P9NpoS2ipsT7G35K0sScB1x/xTdPENwUCgYBvxfwmHXWaRs8xp+4i/GAGwTMh1dr79LF82lPdo7tgjHSUM7DfkA68gTzYEoDrb8WVAnEOVClMTPt4heoiPJ9gH3l8gmIwUwqsAYhr4clHnjQ4xP/y8ivyWxoIBbiu2cHv5Y+I765g1Svi6ZTkf5CEjAX5SD0ds35m979u9rWiQA==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsGgFNhevx9HzekAssIf3b+NXrIcZCH+CUImH4U+6OfIDw1256TiUPYDUgbcOxRznmQHC+vyqVoEY83aGZ618cIH+DjytYp47QBRhwmx4KeRulvv27qg97dCLAJT8I/cIkQXV/jt092fntFTJmGre9f4kZVL/qjiAFJY3E3D6qnWP1nxS1b0F8J/AL8AUrJjIGgqoJXr5djOe7WKL9X7hmk1Fb33EftQOHCs4qGfnY/2qrgy4eYVm35+3Ry9S0fpwcA57HnLdw/F/HQ+5gywmpWNDkmYEm7WV6hOIqJ+Ez4viXNXq3RpHqU/duVt3PgdkEyWvf+rKCdKJ1HCZLftRwQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = " http://569wf5.natappfree.cc/afterPay";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = " http://569wf5.natappfree.cc/html/trun.html";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";

//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

